#ifndef POINT2D_H
#define POINT2D_H

#include <QtGlobal>

class Point2d
{
private:
    double latitude;
    double longitude;
public:
    explicit Point2d(double latitude = 0, double longitude = 0);
    double getLatitude() const;
    double getRadianLatitude() const;
    double getLongitude() const;
    double getRadianLongitude() const;
    void setLatitude(double latitude);
    void setLongitude(double longitude);
    const Point2d & normalize();
    static int distance(double lat1, double lon1, double lat2, double lon2);
    static int distance(const Point2d & p1, const Point2d & p2);

    Point2d &operator+=(const Point2d &p);
    Point2d &operator-=(const Point2d &p);

    friend inline bool operator==(const Point2d &, const Point2d &);
    friend inline bool operator!=(const Point2d &, const Point2d &);
    friend inline Point2d operator+(const Point2d &, const Point2d &);
    friend inline Point2d operator-(const Point2d &, const Point2d &);
    friend inline Point2d operator-(const Point2d &);
    friend inline uint qHash(const Point2d & key);
};

#endif // POINT2D_H
